package com.fs.controller;

import com.fs.pojo.GoodsCart;
import com.fs.vo.PageResult;
import com.fs.vo.SysResult;
import com.fs.service.GoodsCartService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@Api(tags = "购物车管理--废弃")
@RestController
@RequestMapping("/goodsCart")
public class GoodsCartController {
    @Autowired
    private GoodsCartService goodsCartService;

    @ApiOperation(value = "添加进购物车")
    @PostMapping("/add")
    public SysResult add(@RequestBody GoodsCart entity){
        return goodsCartService.add(entity);
    }

    @ApiOperation(value = "编辑购物车")
    @PutMapping("/edit")
    public SysResult edit(@RequestBody GoodsCart entity){
        return goodsCartService.edit(entity);
    }

    @ApiOperation(value = "购物车列表")
    @GetMapping("/list")
    public SysResult list(PageResult request){
        return goodsCartService.list(request);
    }

    @ApiOperation(value = "删除购物车指定商品")
    @DeleteMapping("/{id}")
    public SysResult deleteById(@PathVariable("id") Integer id){
        return goodsCartService.delById(id);
    }

}
